﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.stats.experiments {
    import flash.utils.*;
    import flash.external.*;

    public class ExperimentManager {

        private var m_experiments:Dictionary;

        public function ExperimentManager(){
            this.m_experiments = new Dictionary();
        }
        public function init():void{
            var _local1:Array = ExternalInterface.call("getExperiments");
            this.loadExperiments(_local1);
        }
        public function getExperiment(_arg1:String):Experiment{
            return ((this.m_experiments[_arg1] as Experiment));
        }
        public function getVariant(_arg1:String):int{
            var _local2:int;
            var _local3:Experiment = this.getExperiment(_arg1);
            if (_local3){
                _local2 = _local3.variant;
            };
            return (_local2);
        }
        public function inPerfExperiment(_arg1:String, _arg2:String):Boolean{
            var _local5:Experiment;
            var _local3:Boolean;
            var _local4:Experiment = this.getExperiment(_arg1);
            if (((_local4) && (_local4.variant))){
                _local5 = this.getExperiment(_arg2);
                _local3 = ((_local5) && (_local5.variant));
            };
            return (_local3);
        }
        public function filterXmlByExperiment(_arg1:XMLList):XMLList{
            var _local3:*;
            var _local4:String;
            var _local5:String;
            var _local6:String;
            var _local2:XMLList = new XMLList();
            for each (_local3 in _arg1) {
                if (_local3.hasOwnProperty("@_zexp")){
                    _local4 = String(_local3.@_zexp);
                    _local5 = String(this.getVariant(_local4));
                    //unresolved if
                    _local6 = String(_local3.@_zvar);
                    //unresolved if
                } else {
                    _local2 = (_local2 + _local3);
                };
            };
            return (_local2);
        }
        private function loadExperiments(_arg1:Array):void{
            var _local2:Object;
            var _local3:String;
            for each (_local2 in _arg1) {
                _local3 = (_local2["name"] as String);
                this.m_experiments[_local3] = Experiment.loadObject(_local2);
            };
        }

    }
}//package Modules.stats.experiments 
